package com.example.user.quartz;

import com.example.user.service.UserService;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.util.Date;

//@DisallowConcurrentExecution//禁止多实例
@PersistJobDataAfterExecution//dataMap持久化单例只针对job 不针对trigger
public class MyJob extends QuartzJobBean {
    @Autowired
    private UserService userService;
    @Override
    public void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("执行了定时任务" + new Date());
        /*JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
        JobDataMap jobDataMap1 = jobExecutionContext.getTrigger().getJobDataMap();
        System.out.println("job" + jobDataMap.getString("job"));
        System.out.println("job1" + jobDataMap.getString("job1"));*/

        //userService.check(String id);
    }


}
